package com.edu.exam.entity.examination.online.technical;

import com.edu.exam.enums.examination.online.technical.ProfileType;
import com.edu.exam.enums.examination.online.technical.ProfileStatus;
import com.edu.exam.enums.examination.online.technical.ColorMode;
import com.edu.exam.enums.examination.online.technical.FileFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import jakarta.persistence.*;
import java.time.LocalDateTime;

/**
 * 设备配置档案实体类
 *
 * 根据E-04-01设备适配子模块设计实现
 * 存储设备的配置档案和参数设置。
 *
 * @author System
 * @version 1.0.0
 */

@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class DeviceProfile {

    /**
     * 档案ID，主键
     */
    @Id
    @Column(name = "profile_id", length = 64)
    private String profileId;

    /**
     * 设备ID
     */
    @Column(name = "device_id", length = 64, nullable = false)
    private String deviceId;

    /**
     * 档案名称
     */
    @Column(name = "profile_name", length = 128, nullable = false)
    private String profileName;

    /**
     * 档案类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "profile_type", length = 32, nullable = false)
    private ProfileType profileType;

    /**
     * 档案状态
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "profile_status", length = 32, nullable = false)
    private ProfileStatus profileStatus;

    /**
     * 扫描分辨率
     */
    @Column(name = "scan_resolution")
    private Integer scanResolution;

    /**
     * 色彩模式
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "color_mode", length = 32)
    private ColorMode colorMode;

    /**
     * 文件格式
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "file_format", length = 32)
    private FileFormat fileFormat;

    /**
     * 亮度设置
     */
    @Column(name = "brightness")
    private Integer brightness;

    /**
     * 对比度设置
     */
    @Column(name = "contrast")
    private Integer contrast;

    /**
     * 压缩质量
     */
    @Column(name = "compression_quality")
    private Integer compressionQuality;

    /**
     * 最大宽度
     */
    @Column(name = "max_width")
    private Integer maxWidth;

    /**
     * 最大高度
     */
    @Column(name = "max_height")
    private Integer maxHeight;

    /**
     * 是否自动进纸
     */
    @Column(name = "auto_feed")
    private Boolean autoFeed;

    /**
     * 是否双面扫描
     */
    @Column(name = "duplex_scan")
    private Boolean duplexScan;

    /**
     * 超时设置（秒）
     */
    @Column(name = "timeout_seconds")
    private Integer timeoutSeconds;

    /**
     * 批量处理大小
     */
    @Column(name = "batch_size")
    private Integer batchSize;

    /**
     * 高级配置参数
     */
    @Column(name = "advanced_settings", columnDefinition = "TEXT")
    private String advancedSettings;

    /**
     * 档案描述
     */
    @Column(name = "profile_description", length = 512)
    private String profileDescription;

    /**
     * 是否为默认配置
     */
    @Column(name = "is_default", nullable = false)
    private Boolean isDefault;

    /**
     * 是否激活
     */
    @Column(name = "is_active", nullable = false)
    private Boolean isActive;

    /**
     * 性能评级
     */
    @Column(name = "performance_rating")
    private Integer performanceRating;

    /**
     * 质量评级
     */
    @Column(name = "quality_rating")
    private Integer qualityRating;

    /**
     * 使用次数
     */
    @Column(name = "usage_count")
    private Long usageCount;

    /**
     * 最后使用时间
     */
    @Column(name = "last_used_time")
    private LocalDateTime lastUsedTime;

    /**
     * 创建人ID
     */
    @Column(name = "created_by", length = 64, nullable = false)
    private String createdBy;

    /**
     * 创建时间
     */
    @Column(name = "created_time", nullable = false)
    private LocalDateTime createdTime;

    /**
     * 更新时间
     */
    @Column(name = "updated_time", nullable = false)
    private LocalDateTime updatedTime;

}